/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.isn.hospitalizacion.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author pool
 */
@Entity
@Table(name = "urgencia")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Urgencia.findAll", query = "SELECT u FROM Urgencia u"),
    @NamedQuery(name = "Urgencia.findByCodUrge", query = "SELECT u FROM Urgencia u WHERE u.codUrge = :codUrge"),
    @NamedQuery(name = "Urgencia.findByDescUrge", query = "SELECT u FROM Urgencia u WHERE u.descUrge = :descUrge")})
public class Urgencia implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Cod_Urge", columnDefinition="CHAR(5) unsigned")
    private String codUrge;
    @Column(name = "Desc_Urge")
    private String descUrge;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codUrge")
    private Collection<OrdenHospitalizacion> ordenHospitalizacionCollection;

    public Urgencia() {
    }

    public Urgencia(String codUrge) {
        this.codUrge = codUrge;
    }

    public String getCodUrge() {
        return codUrge;
    }

    public void setCodUrge(String codUrge) {
        this.codUrge = codUrge;
    }

    public String getDescUrge() {
        return descUrge;
    }

    public void setDescUrge(String descUrge) {
        this.descUrge = descUrge;
    }

    @XmlTransient
    public Collection<OrdenHospitalizacion> getOrdenHospitalizacionCollection() {
        return ordenHospitalizacionCollection;
    }

    public void setOrdenHospitalizacionCollection(Collection<OrdenHospitalizacion> ordenHospitalizacionCollection) {
        this.ordenHospitalizacionCollection = ordenHospitalizacionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codUrge != null ? codUrge.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Urgencia)) {
            return false;
        }
        Urgencia other = (Urgencia) object;
        if ((this.codUrge == null && other.codUrge != null) || (this.codUrge != null && !this.codUrge.equals(other.codUrge))) {
            return false;
        }
        return true;
    }
    
}
